<template>
	<view v-if="isZtsj" class="kefu-btn" :class="{platform:isPlatform}" @click.stop="connectSevice">
		<image src="../../static/kefu.png" mode="widthFix"></image>
	</view>
</template>

<script>
	import {
		onlineService
	} from '@/api/index/index.js'
	export default {
		name: "online-service",
		props: {
			// 是否平台客服
			isPlatform: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
        isZtsj:false
			};
		},
		methods: {
			connectSevice() {
				if (this.isPlatform) {
					// 平台客服 直接跳转
					onlineService({}).then(res => {
						if (res.code === 0) {
							window.location.href = res.data
						}
					})
				} else
					this.$emit('service')
			}
		}
	}
</script>

<style lang="scss">
	.kefu-btn {
		width: 44rpx;
		height: 44rpx;

		&.platform {
			width: 80rpx;
			height: 80rpx;
			position: fixed;
			bottom: 300rpx;
			right: 34rpx;
			z-index: 50;
		}

		image {
			width: 100%;
			height: 100%;
		}
	}
</style>
